/********************************************************************
Name: Table 3: Differences in Immigration Attitudes by Party 
	Within County
Author: Dan Thompson
Date: August 2019
Notes:
********************************************************************/

* Set the working directory 
gl root = "$sanctuary_root"
gl root = "YOUR_WORKING_DIRECTORY"

* Bring in the CCES response data
use "$root/data/cces immigration attitude analysis data.dta", clear
	
* Column 1
xtreg against_citizenship dem if year==2006 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_citizenship dem_west dem_south dem_northeast dem_midwest ///
	if year==2006 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_citizenship dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2006 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust

* Column 2
xtreg for_questioning dem if year==2010 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_questioning dem_west dem_south dem_northeast dem_midwest ///
	if year==2010 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_questioning dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2010 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust

* Column 5
xtreg against_hospital_care dem if year==2012 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_hospital_care dem_west dem_south dem_northeast dem_midwest ///
	if year==2012 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_hospital_care dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2012 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust

* Column 6
xtreg against_child_citizenship dem if year==2012 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_child_citizenship dem_west dem_south dem_northeast dem_midwest ///
	if year==2012 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg against_child_citizenship dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2012 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust

* Column 7
xtreg for_deport_undocumented dem if year==2014 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_deport_undocumented dem_west dem_south dem_northeast dem_midwest ///
	if year==2014 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_deport_undocumented dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2014 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust

* Column 8
xtreg for_deport_undocumented dem if year==2016 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_deport_undocumented dem_west dem_south dem_northeast dem_midwest ///
	if year==2016 & (dem==1|rep==1) [aw=weight1], fe i(fips) robust
xtreg for_deport_undocumented dem dem_treat dem_rv dem_rv2 dem_rv3 dem_treat_rv ///
	dem_treat_rv2 dem_treat_rv3 if year==2016 & (dem==1|rep==1) & abs(rv)<25 [aw=weight1], ///
	fe i(fips) robust




